home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / gfx / x11 / xfig.lha / doc / FORMAT2.1 < prev    next >
Text File  |  1994-09-07  |  8KB  |  280 lines

  1. The following is the format of fig output (fig 2.1).
  2.  
  3. (1) The very first line is a comment line containing the name and version:
  4.     #FIG 2.1
  5.  
  6.     The character # at the first column of a line indicates that the line
  7.     is a comment line which will be ignored.
  8.  
  9. (2) The first non-comment line consists of two numbers :
  10.  
  11.     int    fig_resolution        (pixels/inch)
  12.     int    coordinate_system    (1 : origin is at the lower left corner
  13.                      2 : Upper left)
  14.  
  15.     Fig_resolution is the resolution fig is using for the current file.
  16.     It must always be 80 for compatibility with this version of Fig.
  17.     Pixels are assumed to be square.
  18.  
  19. (3) The rest of the file contains various objects.  An object can be one
  20.     of six classes (or types).
  21.  
  22.       i)    Arc.
  23.      ii)    Ellipse which is a generalization of circle.
  24.     iii)    Polyline which includes polygon and box.
  25.      iv)    Spline which includes closed/open control/interpolated spline.
  26.       v)    Text.
  27.      vi)    Compound object which is composed of one or more objects.
  28.  
  29.     In the following elaboration on object formats, every value of fig
  30.     output are separated by blank characters or new line ('\n').  The
  31.     value of the not-used parameters will be -1.
  32.  
  33.     Some fields are described as "enumeration type" or "bit vector"; the 
  34.     values which these fields can take are defined in the header file object.h.
  35.     The pen, arrow_type, and arrow_style fields are described as unused.
  36.     These values may be defined in some future version of Fig.
  37.  
  38.     The color field is defined as follows:
  39.  
  40.     -1 = Default
  41.      0 = Black
  42.      1 = Blue
  43.      2 = Green
  44.      3 = Cyan
  45.      4 = Red
  46.      5 = Magenta
  47.      6 = Yellow
  48.      7 = White
  49.      values from 8 to 2^30-1 = reserved for future use
  50.  
  51.     The depth field is defined as follows:
  52.  
  53.      0 ... 999 where larger value means object is deeper than (under)
  54.            objects with smaller depth
  55.  
  56.     The area fill field is defined as follows:
  57.     
  58.      0 = not filled
  59.      1 = white
  60.     ...  values from 2 to 20 are shades of grey, from lighter to darker
  61.     21 = black
  62.  
  63.     The line_style field is defined as follows:
  64.  
  65.     -1 = Default
  66.      0 = Solid
  67.      1 = Dashed
  68.      2 = Dotted
  69.  
  70.     The style_val field is defined as the length, in pixels, of the on/off dashes
  71.     for dashed lines, and the distance between the dots, in pixels, for dotted lines
  72.  
  73.     (3.1) ARC
  74.  
  75.     First line :
  76.     type    name            (brief description)
  77.     ----    ----            -------------------
  78.     int    object_code        (always 5)
  79.     int    sub_type        (always    1)
  80.     int    line_style        (enumeration type)
  81.     int    line_thickness        (pixels)
  82.     int    color            (enumeration type)
  83.     int    depth            (no units)
  84.     int    pen            (not used)
  85.     int    area_fill        (enumeration type)
  86.     float    style_val        (pixels)
  87.     int    direction        (0 : clockwise, 1 : counterclockwise)
  88.     int    forward_arrow        (0: no forward arrow, 1: on)
  89.     int    backward_arrow        (0: no forward arrow, 1: on)
  90.     float    center_x, center_y    (center of the arc)
  91.     int    x1, y1            (pixels, the 1st point the user entered)
  92.     int    x2, y2            (pixels, the 2nd point)
  93.     int    x3, y3            (pixels, the last point)
  94.  
  95.     Forward arrow line (Optional; absent if forward_arrow is 0) :
  96.     type    name            (brief description)
  97.     ----    ----            -------------------
  98.     int    arrow_type        (not used)
  99.     int    arrow_style        (not used)
  100.     float    arrow_thickness        (pixels)
  101.     float     arrow_width        (pixels)
  102.     float    arrow_height        (pixels)
  103.  
  104.     Backward arrow line (Optional; absent if backward_arrow is 0) :
  105.     type    name            (brief description)
  106.     ----    ----            -------------------
  107.     int    arrow_type        (not used)
  108.     int    arrow_style        (not used)
  109.     float    arrow_thickness        (pixels)
  110.     float    arrow_width        (pixels)
  111.     float    arrow_height        (pixels)
  112.  
  113.     (3.2) COMPOUND
  114.  
  115.     A line with object code 6 signifies the start of a compound.
  116.     There are four more numbers on this line which indicate the
  117.     upper right corner and the lower left corner of the bounding
  118.     box of this compound.  A line with object code -6 signifies
  119.     the end of the compound.  Compound may be nested.
  120.  
  121.     First line :
  122.     type    name            (brief description)
  123.     ----    ----            -------------------
  124.     int    object_code        (always 6)
  125.     int    upperright_corner_x    (pixels)
  126.     int    upperright_corner_y    (pixels)
  127.     int    lowerleft_corner_x    (pixels)
  128.     int    lowerleft_corner_y    (pixels)
  129.  
  130.     Subsequent lines :
  131.     objects
  132.     .
  133.     .
  134.  
  135.     Last line :
  136.     -6
  137.  
  138.     (3.3) ELLIPSE
  139.  
  140.     First line :
  141.     type    name            (brief description)
  142.     ----    ----            -------------------
  143.     int    object_code        (always 1)
  144.     int    sub_type        (1 : ellipse defined by radiuses
  145.                      2 : ellipse defined by diameters
  146.                      3 : circle defined by radius
  147.                      4 : circle defined by diameter)
  148.     int    line_style        (enumeration type)
  149.     int    thickness        (pixels)
  150.     int    color            (enumeration type)
  151.     int    depth            (no units)
  152.     int    pen            (not used)
  153.     int    area_fill        (enumeration type)
  154.     float    style_val        (pixels)
  155.     int    direction        (always 1)
  156.     float    angle            (radians, the angle of the x-axis)
  157.     int    center_x, center_y    (pixels)
  158.     int    radius_x, radius_y    (pixels)
  159.     int    start_x, start_y    (pixels; the 1st point entered)
  160.     int    end_x, end_y        (pixels; the last point entered)
  161.  
  162.     (3.4) POLYLINE
  163.  
  164.     First line :
  165.     type    name            (brief description)
  166.     ----    ----            -------------------
  167.     int    object_code        (always 2)
  168.     int    sub_type        (1 : polyline
  169.                      2 : box
  170.                      3 : polygon
  171.                      4 : arc-box)
  172.                      5 : imported-eps bounding-box)
  173.     int    line_style        (enumeration type)
  174.     int    thickness        (pixels)
  175.     int    color            (enumeration type)
  176.     int    depth            (no units)
  177.     int    pen            (not used)
  178.     int    area_fill        (enumeration type)
  179.     float    style_val        (pixels)
  180.     int    radius            (pixels)
  181.     int    forward_arrow        (0: off, 1: on)
  182.     int    backward_arrow        (0: off, 1: on)
  183.  
  184.     Forward arrow line : same as ARC object
  185.  
  186.     Backward arrow line : same as ARC object
  187.  
  188.     Points line :
  189.     type    name            (brief description)
  190.     ----    ----            -------------------
  191.     int    x1, y1            (pixels)
  192.     int    x2, y2            (pixels)
  193.       .
  194.       .
  195.     int    xn, yn            (this will be the same as the 1st
  196.                     point for polygon and box)
  197.     int    x, y            (always 9999, 9999; marks the end of
  198.                     point for polygon and box)
  199.  
  200.     EPS line :
  201.     type    name            (brief description)
  202.     ----    ----            -------------------
  203.     boolean    flipped            orientation = normal (0) or flipped (1)
  204.     char    file[]            name of eps file to import
  205.  
  206.     (3.5) SPLINE
  207.  
  208.     First line :
  209.     type    name            (brief description)
  210.     ----    ----            -------------------
  211.     int    object_code        (always 3)
  212.     int    sub_type        (0 : open spline
  213.                      1 : closed spline
  214.                      2 : open interpolated spline
  215.                      3 : closed interpolated spline)
  216.     int    line_style        (See the end of this section)
  217.     int    thickness        (pixels)
  218.     int    color            (enumeration type)
  219.     int    depth            (no units)
  220.     int    pen            (not used)
  221.     int    area_fill        (enumeration type)
  222.     float    style_val        (pixels)
  223.     int    forward_arrow        (0: off, 1: on)
  224.     int    backward_arrow        (0: off, 1: on)
  225.  
  226.     Forward arrow line : same as ARC object
  227.  
  228.     Backward arrow line : same as ARC object
  229.  
  230.     Points line : same as POLYLINE object
  231.  
  232.     Control points line (absent if sub_type is 1 or 2) :
  233.     Control points of interpolated spline.  There are two control
  234.     points for each knots.  A section i, of the spline is drawn
  235.     using Bezier cubic with the following four points:
  236.         (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  237.           i  i        i    i      i+1    i+1     i+1   i+1
  238.     For closed interpolated spline the last pair of control points,
  239.     (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  240.     (lx1,ly1) and (rx1,ry1) respectively.
  241.  
  242.     type    name            (brief description)
  243.     ----    ----            -------------------
  244.     float    lx1, ly1        (pixels)
  245.     float    rx1, ry1        (pixels)
  246.     float    lx2, ly2        (pixels)
  247.     float    rx2, ry2        (pixels)
  248.       .
  249.       .
  250.     float    lxn, lyn        (pixels)
  251.     float    rxn, ryn        (pixels)
  252.  
  253.     (3.6) TEXT
  254.     type    name            (brief description)
  255.     ----    ----            -------------------
  256.     int    object             (always 4)
  257.     int    sub_type        (0 : Left justified
  258.                      1 : Center justified
  259.                      2 : Right justified)
  260.     int    font             (enumeration type)
  261.     int    font_size         (points)
  262.     int    pen            (not used)
  263.     int    color            (enumeration type)
  264.     int    depth            (no units)
  265.     float    angle            (radians, the angle of the text)
  266.     int    font_flags        (bit vector)
  267.     int    height            (pixels)
  268.     int    length            (pixels)
  269.     int    x, y            (pixels, coordinate of the origin
  270.                      of the string.  If sub_type = 0, it is
  271.                      the lower left corner of the string.
  272.                      If sub_type = 1, it is the lower
  273.                      center.  Otherwise it is the lower
  274.                      right corner of the string.)
  275.     char    string[]        (ascii characters; starts after a blank
  276.                     character following the last number and
  277.                     ends before the character '\1'.  This
  278.                     character is not part of the string.
  279.                     Note that the string may contain '\n'.)
  280.